package com.esdk.sql;

import java.sql.Connection;
import java.sql.SQLException;

public class ConnMetaData{
  public static final String DatabaseProductName_PostgreSQL="PostgreSQL",DatabaseProductName_Oracle="Oracle",
    DatabaseProductName_MsSQL="Microsoft SQL Server",DatabaseProductName_MySQL="MySQL",DatabaseProductName_HSQL="HSQL Database Engine";

  public String databaseProductName,databaseProductVersion;
  public Integer databaseMajorVersion;
  public ConnMetaData(String databaseProductName,String databaseProductVersion,Integer databaseMajorVersion){
    this.databaseProductName=databaseProductName;
    this.databaseProductVersion=databaseProductVersion;
    this.databaseMajorVersion=databaseMajorVersion;
  }

  public boolean isDoris(){
    return DorisDialect.DorisProductVersion.equals(databaseProductVersion)&&DatabaseProductName_MySQL.equals(databaseProductName);
  }

  public boolean isPostgreSQL(){
    return DatabaseProductName_PostgreSQL.equals(databaseProductName);
  }

  public boolean isMySQL(){
    return DatabaseProductName_MySQL.equals(databaseProductName)&&!DorisDialect.DorisProductVersion.equals(databaseProductVersion);
  }


  public boolean isMsSQL(){
    return DatabaseProductName_MsSQL.equals(databaseProductName)||isHSQL();
  }

  public boolean isHSQL() {
    return DatabaseProductName_HSQL.equals(databaseProductName);
  }
  public boolean isOracle(){
    return DatabaseProductName_Oracle.equalsIgnoreCase(databaseProductName);
  }

}
